aboutsummaryrefslogtreecommitdiffstats
path: root/src/pages/thematique/[slug].tsx
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2023-11-15 12:24:42 +0100
committerArmand Philippot <git@armandphilippot.com>2023-11-15 17:26:16 +0100
commit0f38aee374029213a47ef7c29bd164093fe63c85 (patch)
tree290cb6471fdfe81e4c42f4da4729247536b04ee7 /src/pages/thematique/[slug].tsx
parentbe4d907efb4e2fa658baa7c9b276ed282eb920db (diff)
refactor(hooks): remove useSettings hook
It does not make sense to re-export an existing object through a hook. On some pages both the hook and the object was imported... It is better to use the CONFIG (previously settings) object directly and by doing it we avoid potential errors because of conditional hooks.
Diffstat (limited to 'src/pages/thematique/[slug].tsx')
-rw-r--r--src/pages/thematique/[slug].tsx10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/pages/thematique/[slug].tsx b/src/pages/thematique/[slug].tsx
index 20c1ee8..ea8c6b0 100644
--- a/src/pages/thematique/[slug].tsx
+++ b/src/pages/thematique/[slug].tsx
@@ -22,6 +22,7 @@ import {
} from '../../services/graphql';
import styles from '../../styles/pages/blog.module.scss';
import type { NextPageWithLayout, PageLink, Thematic } from '../../types';
+import { CONFIG } from '../../utils/config';
import { ROUTES } from '../../utils/constants';
import {
getLinksItemData,
@@ -32,7 +33,7 @@ import {
getWebPageSchema,
} from '../../utils/helpers';
import { loadTranslation, type Messages } from '../../utils/helpers/server';
-import { useBreadcrumb, useSettings } from '../../utils/hooks';
+import { useBreadcrumb } from '../../utils/hooks';
export type ThematicPageProps = {
currentThematic: Thematic;
@@ -97,11 +98,10 @@ const ThematicPage: NextPageWithLayout<ThematicPageProps> = ({
(item): item is MetaItemData => !!item
);
- const { website } = useSettings();
const { asPath } = useRouter();
const webpageSchema = getWebPageSchema({
description: seo.description,
- locale: website.locales.default,
+ locale: CONFIG.locales.defaultLocale,
slug: asPath,
title: seo.title,
updateDate: dates.update,
@@ -111,7 +111,7 @@ const ThematicPage: NextPageWithLayout<ThematicPageProps> = ({
description: intro,
id: 'thematic',
kind: 'page',
- locale: website.locales.default,
+ locale: CONFIG.locales.defaultLocale,
slug: asPath,
title,
});
@@ -128,7 +128,7 @@ const ThematicPage: NextPageWithLayout<ThematicPageProps> = ({
description: 'ThematicPage: related topics list widget title',
id: '/42Z0z',
});
- const pageUrl = `${website.url}${asPath}`;
+ const pageUrl = `${CONFIG.url}${asPath}`;
return (
<>